const { nanoid } = require('nanoid'),
    Qiniu = require('qiniu'),
    crypto = require('crypto'),
   { cryptoSecret,qiniu } = require('../config/config');
Qiniu.conf.ACCESS_KEY = qiniu.keys.ak;
Qiniu.conf.SECRET_KEY = qiniu.keys.sk;   
function qiniuUpload(options) {
}
function makeCrypto(str){
    const _md5 = crypto.createHash('md5'),
          content = `str=${str}&secret=${cryptoSecret}`;
    return _md5.update(content).digest('hex')      
}
function trimSpace(str){
    return str.replace(/\s+/g,'');
}
function returnInfo(errorInfo,data){
    if(data){
        errorInfo.data = data
    }
    return errorInfo
}
// function 
module.exports = {
    qiniuUpload,
    makeCrypto,
    trimSpace,
    returnInfo
}     